home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 987 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: clamage@Eng.Sun.COM (Steve Clamage)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Exception handling specs incomplete ?
  5. Date: 06 Apr 1996 11:36:01 PST
  6. Organization: Sun Microsystems Inc., Mountain View, CA
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4k61hc$l3i@engnews1.Eng.Sun.COM>
  9. References: <199604051329.RAA04194@boy.nmd.msu.ru>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 6 Apr 1996 15:10:36 GMT
  12. X-Newsreader: NN version 6.5.0 #21 (NOV)
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMWbHoky4NqrwXLNJAQHsUwH/Q0kUbhqc4wabo24eVqX1JnXa5qT7v37X
  15.     y4uvWwWrXnMrJN0KUIIOCSkEhm0pQzi+6l2Vz4DrVdEuyArbZz4dVQ==
  16.     =VHkI
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. Alexander Krotoff <krotoff@boy.nmd.msu.ru> writes:
  20.  
  21. >I have two notes, about the behavior not specifed in the Jan 96 WP.
  22.  
  23. >1) While stack unwinding the destructor (or function indirectly called from
  24. >the destructor) may try to do throw.
  25.  
  26. >As seems to me WP says nothing about this case. Is it allowed ?
  27. >Is the behavior specified for this case ?
  28.  
  29. The section in the exceptions chapter describing the operation of
  30. function terminate() says that from the point of the throw until the
  31. exception handler is entered, if any user-written function exits via an
  32. exception, terminate is called immediately. That includes your question.
  33.  
  34.  
  35. >2) While stack unwinding the destructor may attempt to create
  36. >new objects, or arrays of class objects with non-trivial destructors
  37. >via operator new. Shall this outside exception affect creation of
  38. >new objects ? (Inner exception will cause destructor calls for all
  39. >already created base classes sub-objects and completely created array
  40. >elements.
  41.  
  42. During stack unwinding, destructors for auto objects are called as
  43. their block is exited. Those destructors do whatever they do. The
  44. fact of being invoked as part of stack unwinding has only one
  45. consequence: if the destructor exits via an exception, terminate() is
  46. called.  A destructor can call function uncaught_exception() to determine
  47. whether exception handling is in progress. ("uncaught_exception() is
  48. a recent addition to the draft standard, and I don't know of any
  49. compilers that support it yet.)
  50. --
  51. Steve Clamage, stephen.clamage@eng.sun.com
  52. ---
  53. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  54.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  55.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  56.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  57.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  58. ]
  59.